import * as types from './mutation-types'

export default {
  [types.GET_USER_INFO](state, {
    info,
    isLogin
  }) {
    state.userInfo = info.userInfo
    state.platList = info.platList
    state.isLogin = isLogin
  },
  [types.SET_USER_INFO](state, {
    info,
    isLogin,
    callback
  }) {
    state.userInfo = info.userInfo
    state.platList = info.platList
    state.isLogin = isLogin
    // state.userInfo.mapType = 4
    if (typeof (callback) === 'function') callback()
  },
  setUnitGroup(state, data) {
    state.unitGroup = data
  },
  setCurrentMapType(state, data) {
    state.currentMapType = data
    localStorage.setItem('ilinkBs_currentMapType', data)
  },
  // 存储当前orgId 用于搜索框
  setCurrentOrgId(state, data) {
    state.currentOrgId = (isNaN(data) ? data : Number(data)) || ''
  },
  // 存储当前楼栋id 用于搜索框
  setCurrentBuildId(state, data) {
    state.currentBuildId = data
  },
  // 存储当前楼层id 用于搜索框
  setCurrentFloorId(state, data) {
    state.currentFloorId = data
  },
  // 搜索框是否展示 用于隐藏维保
  setSearchModelStatus(state, data) {
    state.isSearchShow = data
  },
  // 更新推送数据
  setWsData(state, data) {
    state.wsData = data
  },
  // 更新虚拟路由
  setRouteList(state, data) {
    state.routeList = data
  },
  // 更新单位列表
  setOrgList(state, data) {
    state.orgList = data
  },
  // 更新当前选中巡检计划id
  setCurrentInspectId(state, data) {
    state.currentInspectId = data
  },
  setMapSceneTypeStamp(state, data) {
    state.mapSceneTypeStamp = data
  },
  setIsOutDoor(state, data) {
    state.isOutDoor = data
  },
  setSpeechData(state, data) {
    state.speechData = data
  },
  setCurrentMarkType(state, data) {
    state.currentMarkType = data
  },
  setEquipmentQuery(state, data) {
    state.equipmentQuery = data
  },
  setAutoLogin(state, data) {
    state.isAutoLogin = data
  },
  setBuildMarkType(state, data) {
    state.buildMarkType = data
  },
  setCurInspectId(state, data) {
    state.curInspectId = data
  },
  setShowCorrectPic(state, data) {
    state.showCorrectPic = data
  },
  setPlatConfigInfo(state, data) {
    state.platConfigInfo = data
  },
}
